package com.xiantm.study.thread.workthread.priactice.p2;



import java.util.Random;

public class ClientThread extends Thread{
    private final Channel channel;
    private final Random random = new Random();
    private int number = 0;

    public ClientThread(String name, Channel channel) {
        super(name);
        this.channel = channel;
    }

    @Override
    public void run() {
        String threadName = Thread.currentThread().getName();
        System.out.println(threadName + ": Started");

        while (true){
            Request request = new Request( threadName, number++);
            channel.putRequest(request);
//            try {
//                sleep(random.nextInt(3000));
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
        }
    }
}
